package com.example.tijianbackend.controller;

import com.example.tijianbackend.dto.ReportDTO;
import com.example.tijianbackend.dto.ReportListDTO;
import com.example.tijianbackend.result.Result;
import com.example.tijianbackend.service.ReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: bong~
 * @description: TODO
 * @date: 2024/6/19 9:43
 * @version: 1.0
 */

@RestController
@Slf4j
@RequestMapping("/report")
@Api(tags ="reportController")
@CrossOrigin("*")
public class ReportController {

    @Autowired
    private ReportService reportService;

    @ApiOperation("根据userId 查询体检报告")
    @GetMapping("/list")
    public Result getReportList(String userId){

        List<ReportListDTO> list=reportService.getReportList(userId);

        return Result.success(list);

    }

    @ApiOperation("根据orderId 查询体检结果")
    @GetMapping("/detail")
    public Result getReportList(Integer orderId){

        ReportDTO dto=reportService.getReportDetailList(orderId);

        return Result.success(dto);

    }
}
